home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / program / vol15n11.zip / TBWIZ.ZIP / MAIN.BAS < prev    next >
BASIC Source File  |  1996-02-09  |  2KB  |  54 lines

  1. Attribute VB_Name = "MainModule"
  2. '___Sub Main records the add-in's presence in VB.INI
  3.  
  4. Option Explicit
  5. #If Win16 Then
  6.     Declare Function OSWritePrivateProfileString% Lib "Kernel" Alias "WritePrivateProfileString" (ByVal AppName$, ByVal KeyName$, ByVal keydefault$, ByVal FileName$)
  7.     Declare Function OSGetPrivateProfileString% Lib "Kernel" Alias "GetPrivateProfileString" (ByVal AppName$, ByVal KeyName$, ByVal keydefault$, ByVal ReturnString$, ByVal NumBytes As Integer, ByVal FileName$)
  8. #Else
  9.     Declare Function OSWritePrivateProfileString% Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal AppName$, ByVal KeyName$, ByVal keydefault$, ByVal FileName$)
  10.     Declare Function OSGetPrivateProfileString% Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal AppName$, ByVal KeyName$, ByVal keydefault$, ByVal ReturnString$, ByVal NumBytes As Integer, ByVal FileName$)
  11. #End If
  12.  
  13. 'Mouse Cursor Settings
  14. Global Const DEFAULT = 0
  15. Global Const HOURGLASS = 11
  16. Global gobjIDEAppInst As Object
  17. Global gfnameTBFile As String
  18. Global Const opLoad = 0
  19. Global Const opSave = 1
  20. Sub Main()
  21.  
  22.     Dim ReturnString As String
  23.     Dim Section As String
  24.     Dim ErrCode As Variant
  25.  
  26.     On Error GoTo errMain
  27.     Screen.MousePointer = HOURGLASS
  28.  
  29. '___check for VB.INI entry
  30.     #If Win16 Then
  31.         Section = "Add-Ins16"
  32.     #Else
  33.         Section = "Add-Ins32"
  34.    #End If
  35.  
  36.     ReturnString = String$(255, Chr$(0))
  37.     ErrCode = OSGetPrivateProfileString(Section, "tbWiz.ConnectClass", _
  38.         "NotFound", ReturnString, Len(ReturnString) + 1, "VB.INI")
  39. '___register Add-In' if needed
  40.     If Left$(ReturnString, InStr(ReturnString, Chr$(0)) - 1) = "NotFound" Then
  41.         ErrCode = OSWritePrivateProfileString%(Section, "tbWiz.ConnectClass", "0", "VB.INI")
  42.         MsgBox ("tbWiz has been added to your VB Ini file!")
  43.     End If
  44.  
  45.     Screen.MousePointer = DEFAULT
  46.     Exit Sub
  47.  
  48. errMain:
  49.     Screen.MousePointer = DEFAULT
  50.     MsgBox ("An error occurred while checking the VB.INI file.  " & Error$)
  51.     End
  52.  
  53. End Sub
  54.